package com.example.yucheng.service.impl;

import com.example.yucheng.domain.Stock;
import com.example.yucheng.mapper.StockMapper;
import com.example.yucheng.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StockServiceImpl implements StockService {

    @Autowired
    StockMapper stockMapper;
    @Override
    public List<Stock> getStockList(int pageNum, int pageSize) {
        List<Stock> stockList = stockMapper.getStockList(pageNum,pageSize);
        return stockList;
    }

    @Override
    public void updateStock(Stock stock) {
        stockMapper.updateStock(stock);
    }

    @Override
    public void deleteStock(int id) {
        stockMapper.deleteStock(id);
    }

    @Override
    public void addStock(Stock stock) {
        stockMapper.addStock(stock);
    }

    @Override
    public Stock findStock(String name) {
      return  stockMapper.findStock(name);
    }

    @Override
    public void updateStockNumber(Stock stock) {
        stockMapper.updateStockNumber(stock);
    }

    @Override
    public List<Stock> getAllGood() {
       return stockMapper.getAllGood();
    }

    @Override
    public Stock findGoodNumber(int gId) {
        return stockMapper.findGoodNumber(gId);
    }
}
